using UnityEngine;

public class ObjectTrigger : MonoBehaviour
{
	public string ActiveText = "Interactive";

	public float DistanceLimit = 2f;

	public Vector3 Offset;

	protected GameObject characterTemp;

	public virtual void Start()
	{
	}

	private void Update()
	{
		UpdateFunction();
	}

	protected void UpdateFunction()
	{
		if ((bool)characterTemp)
		{
			if (Vector3.Distance(base.transform.position, characterTemp.transform.position + Offset) > DistanceLimit)
			{
				OnExit();
			}
			else
			{
				OnStay();
			}
		}
	}

	public virtual void OnStay()
	{
	}

	public virtual void OnExit()
	{
		characterTemp = null;
	}

	public virtual void Pickup(GameObject character)
	{
		characterTemp = character;
	}

	public void GetInfo()
	{
		string activeText = ActiveText;
		UnitZ.Hud.ShowInfo(activeText, base.transform.position);
	}
}
